library(rClr)
#clrInit(TRUE)
clrInit()
setRDotNet(TRUE)
# rdn = clrCallStatic('Rclr.ClrFacade', 'get_DataConverter')
# str(rdn)

library(testthat)
# context("rClrTestCases")

cTypename <- "Rclr.TestCases"
testClassName <- "Rclr.TestObject";

testDateStr='2001-01-01'
for (i in 1:100000) {stopifnot(clrCallStatic(cTypename, "DateEquals", as.Date(testDateStr), testDateStr))}

for (i in 1:100) {
test_package('rClr')
}
expect_that( clrCallStatic(cTypename, "DateEquals", as.Date(testDateStr), testDateStr), is_true() );

clrGetStaticMembers('Rclr.ClrFacade')
clrGetStaticMembers('Rclr.ClrFacade')
clrGetStaticMembers('Rclr.ClrFacade')

testObj = clrNew(testClassName)
members = clrReflect(testObj)
expect_that(clrGetFields(testObj, 'IntegerOne'), equals('FieldIntegerOne'))
expect_that(clrGetField(testObj, 'FieldIntegerOne'), equals(0))
expect_that(clrGetProperties(testObj, 'IntegerOne'), equals('PropertyIntegerOne'))
expect_that(clrGetMethods(testObj, 'IntegerOne'), equals(c("get_PropertyIntegerOne", "GetFieldIntegerOne", "set_PropertyIntegerOne")))
expect_that(clrGetMemberSignature(testObj, 'GetFieldIntegerOne'), equals("Method: Int32 GetFieldIntegerOne"))
expect_that(clrGetMemberSignature(testObj, 'GetMethodWithParameters'), equals("Method: Int32 GetMethodWithParameters, Int32, String"))  

clrGetStaticMembers('Rclr.ClrFacade')

